<template>
  <a-modal
      v-model:visible="visible"
      :title="title"
      @ok="handleOk"
      :loading="loading"
  >
    <school-form ref="formRef" :formData="formData"></school-form>
  </a-modal>
</template>

<script lang="ts" setup>
import { Ref, ref } from 'vue'
import { message } from 'ant-design-vue'
import { saveUser } from '@/api/sys-user'
import VSelectDictItem from '@/components/VSelectDictItem.vue'
import VRadioDictItem from '@/components/VRadioDictItem.vue'
import { useModalForm } from '@/modules/use-modules'
import SchoolForm from './SchoolForm.vue';
import {changList } from '@/modules/list'
const formRef =  ref<InstanceType<typeof SchoolForm>>()
const {
  formData,
  loading,
  visible,
  title,
  open,
  close
} = useModalForm({ }, async (data: any) => {
  return {
    ...data,
  }
})
const emits = defineEmits(['ok','getformData'])
const handleOk = async () => {
  // await formRef.value.validate()
  // await saveUser(formData.value)
  console.log(formRef.value,'edit');
  changList(formRef.value?.getformData())
  message.success('操作成功')
  emits('ok')
  close()
}

defineExpose({ open})
</script>
